/*
 * BasicsMath_test.cpp
 *
 *  Created on: 9 июн. 2022 г.
 *      Author: nikitas
 */

#include "BasicsMath_test.h"

namespace STC_calc
{

const std::vector<std::pair<std::string, long double>> BasicsMath_test::checking_list
{
	{"2+2", 4}, {"3*3", 9}, {"100/25", 4}, {"2^10", 1024}, {"100^0.5", 10}, {"log(2;1024)", 10}, {"sin(0)", 0},
	{"(2+2)*2", 8}, {"lg(1000)", 3}, {"1000-3", 997}
};
bool BasicsMath_test::test_all()
{
	for (auto val : checking_list)
	{
		MathFunction func(val.first);
		long double answ = func();
		std::string log;
		if (answ != val.second)
		{
			log = "Error: " + val.first + " get; answer should be " + std::to_string(val.second);
			log+=", but returned" + std::to_string(answ);
			Logger::put(log);
			return false;
		}
		log = val.first + " = " + std::to_string(answ);
		Logger::put(log);
	}
	return true;
}

} /* namespace STC_calc */
